package org.shilong.UI.register;

import org.shilong.UI.R;
import org.shilong.UI.OAuth.OAuthFrame;
import org.shilong.Utility.IntentUtility;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

/**
 * 注册页
 * @author Administrator
 *
 */
public class RegisterFrame extends Activity implements OnClickListener {

	private EditText accoount_name_edittext, account_pwd_edittext;

	private Button registerButton;

	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView( R.layout.layout_register_content );

		initViews();

		registerEvents();

	}

	private void initViews(){

		accoount_name_edittext = ( EditText )this.findViewById( R.id.register_input_account_name );
		account_pwd_edittext = ( EditText )this.findViewById( R.id.register_input_account_pwd );

		registerButton = ( Button )this.findViewById( R.id.to_register_next_button);
	}

	private void registerEvents(){

		registerButton.setOnClickListener( this );

	}

	@Override
	public void onClick(View view) {

		switch ( view.getId() ) {
		case R.id.to_register_next_button :

			to_oauth_logic();

			break;

		default:
			break;
		}

	}

	/**
	 * 跳转授权逻辑
	 */
	private void to_oauth_logic(){

		Bundle bundle = new Bundle();

		bundle.putString( "account_name",  accoount_name_edittext.getText().toString() );
		bundle.putString( "account_pwd", account_pwd_edittext.getText().toString() );


		IntentUtility.goNextFrame( this, OAuthFrame.class, bundle );
	}
}
